package com.foxzzz.flinktest.util;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Scanner;

/**
 * @author: [wujie]
 * @createTime: [2019/12/18 16:11]
 * @description:
 */
public class PredictGender {


    public void init() {

        try (BufferedReader bf = new BufferedReader(new FileReader("train.txt"))) {
            String line = null;
            while ((line = bf.readLine()) != null) {
                String[] split = line.split(",");
                PredictCollection.incr(split[1], split[2]);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }


    public static void main(String[] args) {
        new PredictGender().init();

        Scanner scanner = new Scanner(System.in);
        while (true) {
            String next = scanner.next();
            if (next.length() > 1) {
                next = next.substring(1, next.length());
                PredictVO predictVO = PredictCollection.ComputeLogProb(next);
                System.out.println(predictVO.getFemale() > predictVO.getMale() ? "女" : "男");
            }
        }
    }
}
